<?php

//Group
class Form_Group_Create extends Base_Form
{
    public function init()
    {
		$this->addElements(array(
			// Add an hidden element
            new Zend_Form_Element_Hidden('vid', array(
                'required'   => true,
				'value'      => 0,
				'decorators' =>array(
					'ViewHelper', 'Errors',
				),
                'validators' => array(
					array('validator'=> 'Int')
                )
            )),
			// Add an username element
            new Zend_Form_Element_Text('name', array(
                'required'   => true,
                'label'      => 'Group Name:',
                'filters'    => array('StringTrim'),
                'validators' => array(
					array('validator' => 'StringLength', 'options' => array(4,30))
                )
            )),
			// Add an username element
            new Zend_Form_Element_Text('gid', array(
                'required'   => true,
                'label'      => 'Group id:',
                'filters'    => array('StringTrim'),
                'validators' => array(
					array('validator' => 'Between', 'options' => array('min'=> 1, 'max'=> 99))
                )
            )),
			// Add an username element
            new Zend_Form_Element_Text('area', array(
                'required'   => true,
                'label'      => 'Link area:',
                'filters'    => array('StringTrim'),
                'validators' => array(
                	array('validator' => 'Regex', 'options' => "/^\d{1,4}(,\d{1,4}){3}$/"),
                )
            )),
        ));

        $this->addDisplayGroup(
            array('name','gid','area'), 'group',
			array(
				'legend' => 'Group'
			)
		);
    }
}